<template>
  <div class="home-main-container">
    <el-row>
      <el-col :span="24">
        <act-sw></act-sw>
      </el-col>
    </el-row>
    <el-row class="tagNav" >
      <el-col :span="12" :offset="8">
        <el-menu
          router
          :default-active="$route.path"
          class="el-menu-demo"
          mode="horizontal"
          @select="handleSelect"
          background-color="#fff"
          text-color="black"
          active-text-color="#303133"
        >
          <el-menu-item  v-for="title in titles" :key="title.id" :index="title.name">
          {{title.Tagname}}</el-menu-item>
         
        </el-menu>

      </el-col>

    </el-row>
    <el-col :span="20" :offset="2" style="text-align:center;">
      <router-view></router-view>
    </el-col>
    
  </div>
</template>

<script>
import ActSw from '@/subcomponents/ActSwiper.vue'
export default {
  data() {
    return {
      
      titles:[
        {Tagname:"推荐" , id: 1,name:'/home/homemain/photoShow'},
        {Tagname:"精选" , id: 2 ,name:'/home/homemain/photoShow/2'},
        {Tagname:"精选" , id: 3,name:'/home/homemain/photoShow/3' },
        {Tagname:"最新" , id: 4,name:'/home/homemain/photoShow/4'},
        {Tagname:"人文" , id: 5,name:'/home/homemain/photoShow/5'},
        {Tagname:"人像" , id: 6,name:'/home/homemain/photoShow/6'},
        {Tagname:"风光" , id: 7,name:'/home/homemain/photoShow/7'}
      ]
    };
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    scrollToTop () {
    let that = this
    let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
    that.scrollTop = scrollTop
    if (that.scrollTop > 388) {
      
    } else {
      
    }
  },
  photoShow(id){
    this.$router.push({
      name: 'photoShow',
      params:{
        id: '1'
      }
    })
  }
  },
   mounted () {
  window.addEventListener('scroll', this.scrollToTop)
},
destroyed () {
  window.removeEventListener('scroll', this.scrollToTop)
},

  components: {ActSw}
};
</script>
<style lang="scss" scoped>
.home-main-container {
  
  .tagNav {
    
    width: 100%;
   
    padding-bottom: 0;
    
    font-size: 18px;
    letter-spacing: 1.5px;
  
    border-bottom: solid 1px #e6e6e6;
    background-color: #fff;
    .el-menu-demo {
      border-bottom: solid 1px #fff;
      height: 66px;
      .el-menu-item.is-active{
        font-weight: bold;
      }
    }
  }
  
}


</style>

